<?
include("../Comm/Manage_err.php");
include("../Comm/Conn.php");
include("../Comm/HtmlEdit.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Netsys网站管理系统</title>
<link href="../Style/Css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
function Check()
{
  if (document.MyForm.NTitle.value=="")
  {
	  alert("有*号的必须填写！");
      document.MyForm.NTitle.focus()
      return false
   }
  if (document.MyForm.ClassID.value=="")
  {
	  alert("有*号的必须填写！");
      document.MyForm.ClassID.focus()
      return false
   }
        if (document.MyForm.Uppic.value=="")
  {
	  alert("有*号的必须填写！");
      document.MyForm.Uppic.focus()
      return false
   }
}
</script>
</head>
<body>
<?
if($_POST['Add']){
if($_POST['NHome']==1){
$NHome=1;
}else{
$NHome=0;
}
$datetim=date('Y-m-d');
$sql="insert into Netsys_Product (NTitle,Uppic,NIntro,ClassID,NContent,NTime,NHome) " .
  		"values ('$_POST[NTitle]','$_POST[Uppic]','$_POST[NIntro]','$_POST[ClassID]','$_POST[NContent]','$datetim','$NHome')";
    mysql_query($sql);
     echo "<script language='javascript'>"; 
     echo "alert('产品添加成功！');";
     echo " location='Netsys_list.php';"; 
     echo "</script>";
}
else
{
?>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10"></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="right_tittle">
  <tr>
    <td width="3"><img src="../images/r1.jpg" width="10" height="33" /></td>
    <td><img src="../images/current.jpg" width="9" height="9" /> 当前位置 &gt;&gt; 产品展示 | 发布产品展示</td>
    <td width="10" align="right"><img src="../images/r3.jpg" width="10" height="33" /></td>
  </tr>
</table>
  <table width="98%" border="0" align="center" cellpadding="0" cellspacing="2" class="right_con">
    <tr>
      <td height="490" align="center" valign="top" bgcolor="#FFFFFF">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="5"></td>
        </tr>
      </table>
      <br />
        <form name="MyForm" action="" method="post">
        <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CDD8DF" class="table_all" >
          <tr>
            <td width="19%" align="left" class="Left_td">标题：</td>
            <td width="81%" align="left" class="Right_td">
            <input name="NTitle" type="text" id="NTitle" style="width:300px" value="">
            <font color="#ff0000">*</font>            </td>
          </tr>
          <tr>
            <td align="left" class="Left_td">简介：</td>
            <td align="left" class="Right_td"><textarea name="NIntro" id="NIntro" cols="60" rows="3"></textarea></td>
          </tr>
          <tr>
            <td align="left" class="Left_td">图标：</td>
            <td align="left" class="Right_td"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td id="hiddenframe"><a style="cursor:hand" onClick="document.all.showframe.style.display='';document.all.hiddenframe.style.display='none';">&nbsp;上传图片</a>&nbsp;&nbsp;<a style="cursor:hand" onClick="document.all.adddz.style.display='';document.all.hiddenframe.style.display='none';">插入图片URL</a>
                      <input name="Uppic" type="hidden" id="Uppic">
                  </td>
                </tr>
                <tr>
                  <td height="17" id="showframe" style="display:none"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="245" height="15"><iframe src="../Comm/upfileadd.php?up=../UploadImg/&tup=Uppic&FormName=MyForm" frameborder="0" height="20" width="400" scrolling="no" marginwidth="0" marginheight="0"></iframe></td>
                        <td align="left" valign="baseline"><a style="cursor:hand" onClick="document.all.showframe.style.display='none';document.all.hiddenframe.style.display='';">取消</a> </td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="17" id="adddz" style="display:none"><input name="dz" type="text" id="dz" onChange="document.all.Uppic.value=this.value" size="30" >
                    &nbsp; <a style="cursor:hand" onClick="document.all.adddz.style.display='none';document.all.hiddenframe.style.display='';">取消</a> </td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td align="left" class="Left_td">类型：</td>
            <td align="left" class="Right_td"><select name="ClassID" id="ClassID">
              <option value="">请选择类型</option>
              <?   
             $SQL="SELECT * FROM Netsys_Product_Class order by ClassOrder Asc";
             $query=mysql_query($SQL);
			 $num=mysql_num_rows($query);
			 if($num!=0){
             while($row=mysql_fetch_array($query)){
        ?>
              <option value="<? echo $row['ClassID'];?>"><? echo $row['ClassName'];?></option>
              <?
  }
  }
  else
  {
?>
              <option value="暂无分类">暂无分类</option>
              <?
}
?>
            </select>
            <font color="#ff0000">*</font></td>
          </tr>
          <tr>
            <td align="left" class="Left_td">详细：</td>
            <td align="left" class="Right_td">
			<textarea id="NContent" name="NContent" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;"><?php echo htmlspecialchars($htmlData); ?></textarea>            </td>
          </tr>
          <tr>
            <td align="left" class="Left_td">特殊标记：</td>
            <td align="left" class="Right_td">
            <input name="NHome" type="checkbox" id="NHome" value="1" style="border:none;" />
            新品推荐            </td>
          </tr>
          <tr>
            <td align="left" class="Left_td">&nbsp;</td>
            <td align="left" class="Right_td">
              <input name="submit" type="submit" onClick="return Check();" value=" 确认提交 " class="button">&nbsp;&nbsp;&nbsp;&nbsp;
                <input name="reset" type="reset" value=" 重新填写 " class="button">&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="hidden" name="Add" value="OK">            </td>
          </tr>
        </table>
        </form>
      </td>
    </tr>
</table>
<?
}
?>
</body>
</html>